<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('openID',32)->comment('微信openID');
            $table->string('phone',11)->default('')->comment('手机');
            $table->string('email')->default('')->comment('邮箱');
            $table->unsignedTinyInteger('sex')->default('0')->comment('性别 0-未知| 1-男 |2-女');
            $table->string('avatar')->comment('头像');
            $table->unsignedInteger('sweety')->default('20')->comment('积分');

            $table->string('uid',15)->default('')->comment('学号');
            $table->string('real_name',20)->default('')->comment('真实姓名');
            $table->string('unit',50)->default('')->comment('学院');

            $table->timestamps();
            $table->index('openID');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
